import { pathOr } from 'ramda';

export default function updateBalance({ task, server }) {
	const ops = [];
	switch (task.taskType) {
		case 'vul':
		case 'securityEvent':
			ops.push({
				key: 'maxPage',
				value:
					pathOr(1, ['result', 'addition', 'statistics', 'urls'], task) * -1,
			});
			break;
	}

	server.methods.calcBalance({ ops, uid: task.uid });
}
